import Vue from 'vue'
import Router from 'vue-router'
import login from '@/views/login/routes'
import topic from '@/views/topic/routes'
import user from '@/views/user/routes'
import cate from '@/views/cate/routes'
import comment from '@/views/comment/routes'
import tag from '@/views/tag/routes'
import link from '@/views/link/routes'
import banner from '@/views/banner/routes'
import log from '@/views/log/routes'
import project from '@/views/project/routes'
import setting from '@/views/setting/routes'
import music from '@/views/music/routes'
import book from '@/views/book/routes'

Vue.use(Router)

export const createRouter = () => new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      component: () => import('@/components/layout/layout'),
      children: [
        {
          path: '/',
          name: 'home',
          component: () => import('@/views/index'),
          meta: {
            navShow: true
          }
        }
      ]
    },
    ...login,
    ...topic,
    ...user,
    ...cate,
    ...comment,
    ...tag,
    ...link,
    ...banner,
    ...log,
    ...project,
    ...setting,
    ...music,
    ...book,
    {
      path: '*',
      component: () => import('@/views/404')
    }
  ]
})
